import requsest from "@/utils/request";
import {Message} from "element-ui";

export const comment=(ArticleComments)=>{
    return requsest({
        method:"POST",
        url:"http://localhost:8080/articlecomment/comment",
        data:ArticleComments
    }).then(
        response=>{
            if(response.data.success){
                Message.success("评论成功")
                // return true;

            }
        },
        error=>{
            Message.error("发布失败")
            console.log("发布失败"+error.message);
        }

    )
}
export const getcomment=(articleId)=>{
    return requsest({
        method:"POST",
        url:"http://localhost:8080/articlecomment/getcomment",
        data:articleId
    }).then(
        response=>{
            if(response.data.success){
                return response.data.data

            }
        },
        error=>{
            Message.error("发布失败")
            console.log("发布失败"+error.message);
        }

    )
}
export const getcommentCount=(articleId)=>{
    return requsest({
        method:"POST",
        url:"http://localhost:8080/articlecomment/getcommentCount",
        data:articleId
    }).then(
        response=>{
            if(response.data.success){
                return response.data.data

            }
        },
        error=>{
            Message.error("发布失败")
            console.log("发布失败"+error.message);
        }

    )
}